#ifndef __SCREENCAPTURE_H__
#define __SCREENCAPTURE_H__

#include "MyThread.h"

typedef struct tagScreenParams
{
	int nWidth;
	int nHeigth;
	int nBit;
}ScreenParams;

class IOScreenCaptureNotify
{
public:
	IOScreenCaptureNotify(void){};
	virtual~IOScreenCaptureNotify(void){};
public:
	virtual void OnCaptureNotify(const char *pData, const long nLen, const ScreenParams *pParam) = 0;
};

class CScreenCapture : public CMyThread
{
	enum statusTypes
	{
		capture_status = 1,
		notcapture_status = 0,
	};
public:
	CScreenCapture(IOScreenCaptureNotify *pNotify);
	~CScreenCapture(void);

	void StartCapture(void);
	void StopCapture(void);

protected:
	void ThreadProcMain(void);

private:
	void GetResolution(void);
	bool Init(void);
	void CaptureScreen(void);

private:
	IOScreenCaptureNotify			*m_pNotify;
	bool							m_bExit;

	statusTypes						m_tStatus;
	bool							m_bInit;

	HWND							m_hWnd;
	HBITMAP							m_hBitmap;
	
	HDC								m_hDc;
	HDC								m_hMenDc;

	void							*m_lpData;

	char							*m_pData;
	int								m_nBuffLen;

	int								m_nBit;
	ScreenParams					m_tParam;
};

#endif
